package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.BidExpertDao;
import com.chinasi.model.BidExpert;
import com.chinasi.model.ConsultBasic;
import com.chinasi.model.ExpertBasic;
import com.chinasi.service.BidExpertService;

@Service
public class BidExpertServiceImpl implements BidExpertService {

	/**
	 * BidExpertDAO
	 */
	@Autowired
	private BidExpertDao bidExpertDao;

	@Override
	public Pager findRelationBid(String exportCode, int currentPage) {
		BidExpert searchBean = new BidExpert();
		searchBean.setExpertCode(exportCode);
		Pager pager = new Pager(bidExpertDao.getTotalCount(searchBean),currentPage);
		pager.setData(bidExpertDao.findRelationBid(searchBean, pager));
		return pager;
	}
	
	@Override
	public Pager findRelationAgency(ExpertBasic expert, int currentPage) {
		Pager pager = new Pager(bidExpertDao.getRelationAgencyTotalCount(expert),currentPage);
		pager.setData(bidExpertDao.findRelationAgency(expert,pager));
		return pager;
	}

	@Override
	public Pager findRelationIntegrator(ExpertBasic expert, int currentPage) {
		Pager pager = new Pager(bidExpertDao.getRelationIntegratorTotalCount(expert),currentPage);
		pager.setData(bidExpertDao.findRelationIntegrator(expert,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsumer(ExpertBasic expert, int currentPage) {
		Pager pager = new Pager(bidExpertDao.getRelationConsumerTotalCount(expert),currentPage);
		pager.setData(bidExpertDao.findRelationConsumer(expert,pager));
		return pager;
	}

	@Override
	public Pager findRelationSupervision(ExpertBasic expert, int currentPage) {
		Pager pager = new Pager(bidExpertDao.getRelationSupervisionTotalCount(expert),currentPage);
		pager.setData(bidExpertDao.findRelationSupervision(expert,pager));
		return pager;
	}

	@Override
	public Pager findRelationConsult(ExpertBasic expert, int currentPage) {
		Pager pager = new Pager(bidExpertDao.getRelationConsultTotalCount(expert),currentPage);
		pager.setData(bidExpertDao.findRelationConsult(expert,pager));
		return pager;
	}
}
